package com.onpositive.wikitemplate;

import java.util.ArrayList;

public abstract class BasicTemplateResolver {
	
	abstract public String resolveValue( String str ) ;
	
	protected static ArrayList<String> split(String str) {
		ArrayList<String> arr = new ArrayList<String>() ;
		int prev = 0 ; 
		for( int i = str.indexOf("|") ; i >= 0 ; i = str.indexOf("|",prev) )
		{
			String s = str.substring(prev, i) ;
			if( s.length() != 0 )
				arr.add(s.trim()) ;
			
			prev = i+1 ;						
		}
		if( prev < str.length() )
			arr.add(str.substring(prev).trim()) ;
		return arr;
	}

}
